/*-----------------------------------------------File Info------------------------------------------------
** File Name:               tsm12.h
** Last modified date:      2016.07.22
** Last version:            V0.1
** Description:             
**--------------------------------------------------------------------------------------------------------            
** Created date:            2016.09.07
** author:                  YLY
** Version:                 V0.1
** Descriptions:            键盘扫描处理函数
**--------------------------------------------------------------------------------------------------------
*/

#ifndef _TSM12_H_
#define	_TSM12_H_
#include "userConfig.h"

#define TSERR GLOBAL_ERR
#ifndef TSERR
	#define TSERR(...)
#endif

//#define TSDBG GLOBAL_DBG
#ifndef TSDBG
	#define TSDBG(...)
#endif



/* a,b 表示 Ch_n 和 CH_n-1 的灵敏度配置，
取值范围分二段：
1. 0 ~ 7(灵敏度逐渐降低，只能用十六进制表示)
2. 9 ~ F(灵敏度逐渐降低，只能用十六进制表示)
第 2 段灵敏度整体高于第 1 段灵敏度
*/
#define CH_SENS(a,b) 0x##a##b


typedef enum{
	SENS1 = 0x02, //Sensitivity, Channel 2 and 1
	SENS2 = 0x03, //Channel 4 and 3
	SENS3 = 0x06, //Channel 6 and 5
	SENS4 = 0x07, //Channel 8 and 7
	SENS5 = 0x22, //Channel 10 and 9
	SENS6 = 0x23, //Channel 12 and 11

	CTRL1 = 0x08,
	CTRL2 = 0x09,
	REF_RST1 = 0x0A,
	REF_RST2 = 0x0B,
	CH_HOLD1 = 0x0C,
	CH_HOLD2 = 0x0D,
	CAL_HOLD1 = 0x0E,
	CAL_HOLD2 = 0x0F,
	OUTPUT1 = 0x10,
	OUTPUT2 = 0x11,
	OUTPUT3 = 0x12,
}TSM_RegMapAddr_TypeDef;


#define TSM12S_ADDR 0x68  	//7Bit地址 
typedef enum{
	TS_IDLE,
	TS_FAIL,
	TS_SUCCESS
}teTsFeedback;

/* External varialbles -------------------------------------------------------*/
extern bool tsm12Init(void);
extern uint8_t readTsm12Value(uint8_t *pBuf);
extern void checkTsm12(void);

#endif	//	_TSM12_H_








